package com.xxd.spring.boot.demo.lihonghai.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxd.spring.boot.demo.lihonghai.entity.StudentCurriculumFraction;
import com.xxd.spring.boot.demo.lihonghai.mapper.GradeMapper;
import com.xxd.spring.boot.demo.lihonghai.mapper.StudentCurriculumFractionMapper;
import com.xxd.spring.boot.demo.lihonghai.service.StudentCurriculumFractionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class StudentCurriculumFractionServiceImpl implements StudentCurriculumFractionService {
    @Autowired
    private StudentCurriculumFractionMapper studentCurriculumFractionMapper;
    @Override
    public int add(StudentCurriculumFraction studentCurriculumFraction) {
        return studentCurriculumFractionMapper.insert(studentCurriculumFraction);
    }

    @Override
    public int update(StudentCurriculumFraction studentCurriculumFraction) {
        return studentCurriculumFractionMapper.updateById(studentCurriculumFraction);
    }

    @Override
    public int delete(Integer id) {
        return studentCurriculumFractionMapper.deleteById(id);
    }

    @Override
    public IPage<StudentCurriculumFraction> listpage(Page page, Map<String, Object> params) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.setEntity(params);
        Page respage =studentCurriculumFractionMapper.selectPage(page,queryWrapper);
        return respage;
    }

    @Override
    public List<StudentCurriculumFraction> list(Map<String, Object> params) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.setEntity(params);
        return studentCurriculumFractionMapper.selectList(queryWrapper);
    }
}
